//
//  tool.h
//  tool
//
//  Created by JCong on 15/12/24.
//  Copyright © 2015年 JCK. All rights reserved.
//

#ifndef tool_h
#define tool_h

// App
#define APP_VERSION                 [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]

// System Version
#define SYSTEM_VERSION                             ([[[UIDevice currentDevice] systemVersion] floatValue])
#define SYSTEM_VERSION_EQUAL_TO(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_HIGHER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_EQUAL_TO_OR_HIGHER_THAN(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LOWER_THAN(v)               ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_EQUAL_TO_OR_LOWER_THAN(v)   ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
#define iOS11Later ([UIDevice currentDevice].systemVersion.floatValue >= 11.0f)

// Color
#define RGB(r,g,b)                  [UIColor colorWithRed:r / 255.f green:g / 255.f blue:b / 255.f alpha:1.f]
#define RGBA(r,g,b,a)               [UIColor colorWithRed:r / 255.f green:g / 255.f blue:b / 255.f alpha:a]
#define RGB_HEX(hex)                RGBA((float)((hex & 0xFF0000) >> 16),(float)((hex & 0xFF00) >> 8),(float)(hex & 0xFF),1.f)
#define RGBA_HEX(hex,a)             RGBA((float)((hex & 0xFF0000) >> 16),(float)((hex & 0xFF00) >> 8),(float)(hex & 0xFF),a)
#define RGBColor(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]
#define COLOR_LIGHT_BLUE            RGB_HEX(0x7f8b97)
#define COLOR_DEEP_BLUE             RGB_HEX(0x00b3d6)

#define DefaultColor [UIColor colorWithRed:238/255.0 green:105/255.0 blue:106/255.0 alpha:1]

// Language
#define CURRENT_LANGUAGE            ([[NSLocale preferredLanguages] objectAtIndex:0])
#define IS_LANGUAGE(l)              [CURRENT_LANGUAGE hasPrefix:l]
#define IS_LANGUAGE_EN              IS_LANGUAGE(@"en")


// Font
#define FONT_SOFIA_MEDIUM(s)        [UIFont fontWithName:@"SofiaProSoft-Medium" size:s]
#define FONT_SOFIA_SOFT(s)          [UIFont fontWithName:@"SofiaProSoft" size:s]

// Size
//IPhone屏幕类型定义

// iPhone4

#define iPhone4 ([UIScreen mainScreen].bounds.size.height == 480.0)

// iPhone5

#define iPhone5 ([UIScreen mainScreen].bounds.size.height == 568.0)

// iPhone6

#define iPhone6 ([UIScreen mainScreen].bounds.size.height == 667.0)

// iPhone6p

#define iPhone6p ([UIScreen mainScreen].bounds.size.height == 736.0)

#define KIsiPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO) 

// Screen
#define SCREEN_SIZE                 [[UIScreen mainScreen] bounds].size
#define SCREEN_WIDTH                [[UIScreen mainScreen] bounds].size.width
#define SCREEN_HEIGHT               [[UIScreen mainScreen] bounds].size.height

//x的高度不一样
#define SafeAreaTopHeight (ScreenHeight == 812.0 ? 88 : 64)
#define SafeAreaBottomHeight (ScreenHeight == 812.0 ? 34 : 0)

// GCD
#define GCD_GLOBAL(block)           dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block)
#define GCD_MAIN(block)             dispatch_async(dispatch_get_main_queue(), block)

// 网络请求
#define ErrorShow(s) [SVProgressHUD showImage:[UIImage imageNamed:@"errorlogin"] status:s];
//#define ServerAddressURL  @"http://www.yaodongxiao.com:8002/" // 正式外网
//#define ServerAddressURLAPI  @"http://www.yaodongxiao.com:8003/"// H5网站地址 正式外网
//#define ServerAddressURL  @"http://172.16.1.155:7003/" // 内网 豪、
//#define ServerAddressURL(atricleid)  [NSString stringWithFormat:@"%@",atricleid]
#define ServerAddressURL  @"http://172.16.1.146:8002/"// 外网 汪哥
//#define ServerAddressURL  @"http://172.16.1.222:8002/"// APP站点域名 _外网 汪哥
#define ServerAddressURLAPI  @"http://172.16.1.222:8003/"// H5网站地址 _外网 汪哥


// socket

//#define SocketServerAddressIP  @"172.16.1.155" // 内网 豪
//#define SocketServerAddressIP(atricleid)  [NSString stringWithFormat:@"%@",atricleid]

#define SocketServerAddressIP  @"182.92.150.211" // 正式外网

//#define SocketServerAddressIP  @"172.16.1.146" // 内网汪哥
//#define kDefaultPort  2014
#define kDefaultPort  7700
#define UserPhoneName  [[[UIDevice currentDevice] identifierForVendor] UUIDString]


#define Socket1003  @"Socket1003" // 新订单
#define Socket1006  @"Socket1006" // 订单新消息
#define Socket1008  @"Socket1008" // 取消订单
#define Socket1014  @"Socket1014" // 收款
/*
 /// <summary>
 /// 服务器收到心跳协议号
 /// </summary>
 Heart = 1000,
 /// <summary>
 /// 服务器收到经纬度
 /// </summary>
 AcceptLocation = 1001,
 /// <summary>
 /// 服务器收到用工申请
 AcceptReplayChe = 1002,
 /// <summary>
 /// 服务器“发送”用工申请给工人
 SendReplayChe = 1003,
 /// <summary>
 /// 服务器收到取消订单通知
 /// </summary>
 AcceptCancelOrder = 1004,
 /// <summary>
 /// 服务器收到抢单成功通知
 /// </summary>
 AcceptOrderSuccess = 1005,
 /// <summary>
 /// 服务器“发送”订单状态变更通知
 /// </summary>
 SendOrderStatus = 1006,
 /// <summary>
 /// 服务器接收订单状态通知
 /// </summary>
 AccptOrderStatus = 1007,
 /// <summary>
 /// 服务器发送取消订单给工人
 /// </summary>
 SendCancelOrder = 1008,
 
 /// <summary>
 /// 雇主方付款成功指令
 /// </summary>
 PaySuccess=1013,
 /// <summary>
 /// 雇主方付款成功回传指令，更新工人钱包
 /// </summary>
 PayReturn=1014,
 */
//
//static NSString *urseID = @"";
#import "UIView+Badge.h"
#import "UIView+Frame.h"
#import "UIView+MyOther.h"


#endif /* tool_h */
